/*
 * Rho.h
 *
 *  Created on: May 24, 2011
 *      Author: marchi
 */

#ifndef RHO_H_
#define RHO_H_

#include <iostream>
#include "typedefs.h"
#include "Charges.h"
#include "Grid.h"
using namespace Array;
#define VERTEX 8


class Rho : public Grid {
protected:
	real qq[VERTEX];
	static const rvec cube[VERTEX];
	real TriDiff(real g, real cubi){return((g-cubi>=0.0)? cubi-g+1 : g-cubi+1);};
	void TriLinear(real, real, real, real);
public:
	Rho():Grid(){};
	Rho & operator=(const Grid &);
	Rho & operator=(const double &);
	void Density(Charges & );
	double Sum(){
		double tot=0.0;
		for(unsigned int i=0;i<this->Size();i++) tot+=this->v[i];
		return tot;
	};
};

#endif /* RHO_H_ */
